/**
 * This file is part of 1genia trampoline
 * Copyright (C) 2007 1genia (contact@1genia.com)
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; version 3 of the License. 
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; see the file COPYING.TXT.  If not,
 * write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301, USA. 
 **/
package com.genia.toolbox.web.gwt.form.client.service;

import java.util.List;

import com.genia.toolbox.web.gwt.basics.client.oracle.SimpleSuggestion;
import com.genia.toolbox.web.gwt.form.client.form.Form;
import com.genia.toolbox.web.gwt.form.client.value.DataIdentifier;
import com.genia.toolbox.web.gwt.form.client.value.FormValues;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.SuggestOracle.Request;

/**
 * Async service for <code>FormService</code>.
 */
public interface FormServiceAsync
{
  /**
   * the async method for getForm().
   * 
   * @param formIdentifier
   *          the form identifier
   * @param dataIdentifier
   *          the data identifier
   * @param callback
   *          the callback
   */
  public abstract void getForm(String formIdentifier, DataIdentifier dataIdentifier, AsyncCallback<Form> callback);



  /**
   * the async method for getIntialValue().
   * 
   * @param formIdentifier
   *          the form identifier
   * @param dataIdentifier
   *          the data identifier
   * @param callback
   *          the callback
   */
  public abstract void getIntialValue(String formIdentifier, DataIdentifier dataIdentifier, AsyncCallback<FormValues> callback);



  /**
   * the async method for saveForm().
   * 
   * @param newValues
   *          the new values entered by the user
   * @param callback
   *          the callback
   */
  public abstract void saveForm(FormValues newValues, AsyncCallback<FormValues> callback);



  /**
   * get the display string for a given value.
   * 
   * @param formIdentifier
   *          the form identifier
   * @param fieldName
   *          the field name
   * @param value
   *          the current value of the field
   * @param callback
   *          the callback
   */
  public abstract void getDisplayString(String formIdentifier, String fieldName, String value, AsyncCallback<String> callback);



  /**
   * get suggestions for a field.
   * 
   * @param formIdentifier
   *          the form identifier
   * @param dataIdentifier
   *          the data identifier
   * @param fieldName
   *          the field name
   * @param request
   *          the oracle request
   * @param callback
   *          the callback
   */
  public abstract void getSuggestions(String formIdentifier, DataIdentifier dataIdentifier, String fieldName, Request request, AsyncCallback<List<SimpleSuggestion>> callback);

}
